package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.DTO.InsertUserBankAccountBO;
import com.ruoyi.common.core.domain.DTO.InsertUserZfbAccountBO;
import com.ruoyi.common.core.domain.DTO.UpdateUserBankAccountBO;
import com.ruoyi.common.core.domain.DTO.UpdateUserZfbAccountBO;
import com.ruoyi.framework.web.service.UserBankAccountService;
import com.ruoyi.framework.web.service.UserZfbAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
public class UserZfbAccountController extends BaseController {
    @Autowired
    private UserZfbAccountService userZfbAccountService;

    @PostMapping("/insertUserZfbAccount")
    public AjaxResult insertUserZfbAccount(@RequestBody @Valid InsertUserZfbAccountBO insertUserZfbAccountBO) {
        userZfbAccountService.insertUserZfbAccount(insertUserZfbAccountBO);
        return success();
    }

    @PostMapping("/updateUserZfbAccount")
    public AjaxResult updateUserZfbAccount(@RequestBody UpdateUserZfbAccountBO updateUserZfbAccountBO) {
        userZfbAccountService.updateUserZfbAccount(updateUserZfbAccountBO);
        return success();
    }

    @GetMapping("/selectUserZfbAccountByUserId/{userId}")
    public AjaxResult selectUserZfbAccountByUserId(@PathVariable Long userId) {
        return success().put("data", userZfbAccountService.selectUserZfbAccountByUserId(userId));
    }
}
